package com.atde._05_behavioral_design_patterns.interpreter;


import java.util.HashMap;

/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._05_behavioral_design_patterns.interpreter
 * @Author: Del
 * @CreateTime: 2025-06-30  09:28
 * @Description: TODO
 * @Version: 1.0
 */
public class SubExpression extends SymbolExpression{
    public SubExpression(Expression left, Expression right) {
        super(left, right);
    }

    // 求出left 和 right 表达式相减的结果
    public int interpret(HashMap<String, Integer> var) {
        return super.left.interpret(var) - super.right.interpret(var);
    }
}

